package edu.scau.hibernate.service;

import java.util.List;

import edu.scau.hibernate.dao.BaseDao;
import edu.scau.hibernate.dao.BaseDaoImpl;
import edu.scau.hibernate.model.Department;

public class DepartmentServiceImpl implements DepartmentService {
	private BaseDao<Department> departmentImpl=null;
	public DepartmentServiceImpl() throws Exception{
		super();
		departmentImpl =new BaseDaoImpl<Department>();
	}
	@Override
	public boolean deleteDepartment(Department department) throws Exception {
		departmentImpl.delete(department);
		return true;
	}

	@Override
	public boolean updateDepartment(Department department) throws Exception {
		departmentImpl.update(department);
		return true;
	}

	@Override
	public Department findDepartmentByID(int ID) throws Exception {
		return departmentImpl.findById(ID);
	}

	@Override
	public List<Department> findAllDepartment() throws Exception {
		return departmentImpl.findAll();
	}

	@Override
	public boolean addDepartment(Department department) throws Exception {
		departmentImpl.save(department);
		return true;
	}

}
